Expand description

Breadth-first exhaustive zip for repeatable iterators. Behavior matches the following pseudocode specification:

  • Initialize a counter i at zero.
  • When propmted, pull the first element from each iterator.
    • If any iterator is empty, return None.
  • When prompted again, advance only the last iterator.
  • Continue to do so until the last iterator terminates or reaches its ith element.
    • When it does so, reset it and pull the next element from the second-to-last iterator.
  • Repeat this process until we exhaust the first iterator.
    • When you’ve done that, increase i and repeat.
  • Once i exceeds the longest iterator’s length, we’re done: return None.

Structs

  • End of a recursive implementation of a breadth-first exhaustive zip.
  • Helper struct for a breadth-first zip: a counter controlling the maximum index sum of the internal recursive implementation.
  • Recursive implementation of a breadth-first exhaustive zip.

Traits

  • Helper trait returning a nested list that will be turned into a flat list for a huge but finite range of tuple sizes.
  • Zip a tuple into a lazy breadth-first traversal of each possible combination with a monotonically increasing sum of indices.
  • Flatten a nested tuple like (A, (B, (C, ()))) to a flat one like (A, B, C)